<template>
	<view class="container">
		<view class="top">{{ article.name }}</view>
		<view class="middle">
			<rich-text :nodes="article.content"></rich-text>
		</view>
		<!-- <view class="bottom">收藏 | 分享 | 转发</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				article:{
					name:'',
					content:''
				}
			}
		},
		onLoad(e) {
			if(!e.id){
				return uni.redirectTo({
					url:"/pages/my/my"
				});
			}
			this.$http.httpReq({url:'api/index/article',data:{id:e.id}})
				.then(res=>{
					let data = res.data.data;
					if(res.data.code==400){
						return uni.redirectTo({
							url:"/pages/my/article"
						});
					}
					this.article = data.article;
				})
				.catch(err=>{
					console.log(err);
				})
		},
		methods: {
			
		}
	}
</script>

<style lang="scss">
	.container{
		.top{
			padding: 20rpx;
			font-weight: bold;
			font-size: 60rpx;
			text-align: center;
		}
		.middle{
			padding: 10rpx 20rpx;
			line-height: 40rpx;
		}
	}
</style>
